package com.jiajia.study.heap;

import java.util.ArrayList;
import java.util.List;

/**
 * <h1> 演示堆内存溢出 </h1>
 * vm : -Xms8m
 * @author zjiajia
 * @date 2023/11/15 23:09
 */
public class Demo1 {
    public static void main(String[] args) {
        int i = 0;
        List<String> list= new ArrayList<>();

        try {
            String str = "hello";
            while(true){
                list.add(str);
                str = str + str;
                i++;
            }
        } catch (Throwable e) {
            e.printStackTrace();
            System.out.println(">>>>>>>>>>>>>>>>" + i);
        }
    }
}
